﻿using Microsoft.AspNetCore.Mvc;
using JESAI.Framework.Mvc;
using System.Security.Cryptography;

namespace JESAI.Platform.WebApi.Controllers
{
    /// <summary>
    /// 系统控制器
    /// </summary>
    [ApiController]
    [Route("api/v1/[controller]/[action]")]
    public class SysController : ApiControllerBase
    {
        [HttpGet]
        public IActionResult GetSecret()
        {
            byte[] key = new byte[32];
            using (RNGCryptoServiceProvider rngCsp = new RNGCryptoServiceProvider())
            {
                rngCsp.GetBytes(key);
            }
            string base64Key = Convert.ToBase64String(key);
            string base64Key32 = base64Key.Replace("+", "").Replace("/", "").Replace("=", "").Substring(0, 32);

            return Success(base64Key32);
        }


    }
}
